home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 30 / Mac Magazin and MacEasy Magazine CD - Issue 30.iso / utilities / Mac OS X / Load_Monitor / src / TranslucentWindow.m < prev   
Encoding:
Text File  |  2001-11-24  |  1.5 KB  |  58 lines

  1. //
  2. //  TranslucentView.m
  3. //
  4. //  Created by Takashi T. Hamada on Thu Nov 01 2000.
  5. //  Copyright (c) 2000,2001 Takashi T. Hamada. All rights reserved.
  6. //
  7.  
  8. #import "TranslucentWindow.h"
  9.  
  10.  
  11. @implementation TranslucentWindow
  12.  
  13. //-------------------------------------------------------------
  14. // set the transparency
  15. //-------------------------------------------------------------
  16. - (float)_transparency
  17. {
  18.     return 0.99999;
  19. }
  20.  
  21.  
  22. // Not much here, just calling the following private API.
  23. extern void _NSSetWindowOpacity(int windowNumber, BOOL isOpaque);
  24.  
  25.  
  26. //-------------------------------------------------------------
  27. // make the window (pseudo) transparent
  28. //-------------------------------------------------------------
  29. - initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag
  30. {
  31.     if (self = [super initWithContentRect:contentRect styleMask:aStyle backing:bufferingType defer:flag])
  32.         _NSSetWindowOpacity([self windowNumber], 0);
  33.  
  34.     [self setAcceptsMouseMovedEvents:YES];    // for dragging itself by receiving the mouse events
  35.     
  36.     return self;
  37. }
  38.  
  39.  
  40. //-------------------------------------------------------------
  41. // no shadow is needed
  42. //-------------------------------------------------------------
  43. - (BOOL)hasShadow
  44. {
  45.     return NO;
  46. }
  47.  
  48.  
  49. //-------------------------------------------------------------
  50. // For displaying the tooltips with transparent window
  51. //-------------------------------------------------------------
  52. - (BOOL)canBecomeKeyWindow
  53. {
  54.     return YES;
  55. }
  56.  
  57. @end
  58.